﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using System.Security.Cryptography;

namespace Revis.VClinicNet.Core.Domain.Credentials
{
    public class Sha1PasswordEncrypter : IPasswordEncrypter
    {
        public string Encrypt(string plainPassword)
        {
            ASCIIEncoding encoder = new ASCIIEncoding();
            SHA1Managed hasher = new SHA1Managed();

            byte[] bytePassword = encoder.GetBytes(plainPassword);
            byte[] hash = hasher.ComputeHash(bytePassword);

            return encoder.GetString(hash);
        }
    }
}
